package com.aaa.controller.api;

import com.aaa.aop.annotation.Log;
import com.aaa.entity.DictData;
import com.aaa.entity.Notice;
import com.aaa.service.NoticeService;
import com.aaa.vo.NoticeVo;
import com.aaa.vo.Result;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;

/**
 * @BelongsPackage: com.aaa.controller.api
 * @Description: 1.0
 * @CreateTime: 2023-03-29  15:25
 * @Author: ql
 */
@RestController
@RequestMapping("system/api/notice")
public class ApiNoticeController {

    @Autowired
    private NoticeService noticeService;


    @PostMapping("/queryPageList")
    public Result<IPage<Notice>> queryPageList(@RequestBody NoticeVo noticeVo){
        return noticeService.queryPageList(noticeVo);
    }

    @GetMapping("/queryNoticeById/{id}")
    public Result<Notice> queryNoticeById(@PathVariable Long id){
       return noticeService.queryNoticeById(id);
    }

    @PostMapping("/addOrUpdNotice")

    public Result<String> addOrUpdNotice(@RequestBody Notice notice){
        return noticeService.addOrUpdNotice(notice);
    }

    @DeleteMapping("/deleteNoticeByIds/{id}")
    @Log(title = "通告",business_type = "1")
    public Result<String> deleteNoticeByIds(@PathVariable Long[] id){
        System.out.println("=========== " + Arrays.toString(id));
        return noticeService.deleteNoticeByIds(id);

    }



}
